package com.itheima.user.controller;


import com.itheima.common.vo.PageResultVo;
import com.itheima.common.vo.ResultVo;
import com.itheima.core.controller.AbstractCoreController;
import com.itheima.user.dto.ApUserRealnamePageRequestDto;
import com.itheima.user.pojo.ApUserRealname;
import com.itheima.user.service.ApUserRealnameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @version 1.0
 * @description <p>APP实名认证信息</p>
 * @package com.itheima.user.controller
 */
@Api(value = "ApUserRealnameController", tags = "APP实名认证信息")
@RestController
@RequestMapping("/auth")
public class ApUserRealnameController extends AbstractCoreController<ApUserRealname> {

    private ApUserRealnameService apUserRealnameService;

    @Autowired
    public ApUserRealnameController(ApUserRealnameService apUserRealnameService) {
        super(apUserRealnameService);
        this.apUserRealnameService = apUserRealnameService;
    }

    //    分页查询操作
    @PostMapping("/list")
    @ApiOperation("分页查询")
//    分页查询  返回结果就行
    public PageResultVo demo(@RequestBody ApUserRealnamePageRequestDto dto) {
        PageResultVo page = apUserRealnameService.pageList(dto);
        return page;
    }

    @PostMapping("/authFail")
    @ApiOperation("状态驳回")
    public ResultVo reject(@RequestBody HashMap<String, Object> map) {

        apUserRealnameService.reject(map);
        return ResultVo.ok();
    }

    @PostMapping("/authPass")
    @ApiOperation("状态审核通过")
    public ResultVo pass(@RequestBody HashMap<String, Object> map) {

        apUserRealnameService.pass(map);
        return ResultVo.ok();
    }


}

